package com.kingviker.example.nio;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

/**
 * 类型化的get和put
 */
public class NioTest5 {
    public static void main(String[] args) throws IOException {
       ByteBuffer byteBuffer = ByteBuffer.allocate(64);
       byteBuffer.putInt(15);
       byteBuffer.putLong(5000000L);
       byteBuffer.putChar('你');
        byteBuffer.putShort((short)2);
       byteBuffer.putChar('我');

       byteBuffer.flip();

        System.out.println(byteBuffer.getInt());
        System.out.println(byteBuffer.getLong());
        System.out.println(byteBuffer.getChar());
        System.out.println(byteBuffer.getShort());
        System.out.println(byteBuffer.getChar());

    }
}
